#ifndef _CRT_ASSERT_HPP_
#define _CRT_ASSERT_HPP_

#include <crt_core.hpp>
#include <crt_log.h>

// this linux kernel if
// #define likely(x)      __builtin_expect(!!(x), 1)
// #define unlikely(x)    __builtin_expect(!!(x), 0)

#define rs_error(p, v) \
    do { \
        if ((int)(p)) \
            return v; \
    } while (0);

#define rc_error(p, v) \
    do { \
        if (!(int)(p)) \
            return v; \
    } while (0);

#define rc_return(p) \
    do { \
        if (!(int)(p)) \
            return; \
    } while (0);

#define rs_error_continue(p) \
    if ((int)(p)) \
        continue;

#define rc_error_continue(p) \
    if (!(int)(p)) \
        continue;

#define rc_error_break(p) \
    if (!(int)(p)) \
        break;

#endif
